The present invention relates to a three-dimensional graphics drawing apparatus for developing image data from three-dimensional polygon information to pixels by computer processes and for displaying the image data and, more particularly, to a 3-dimensional graphics drawing apparatus for performing an expression of a quality feeling by a texture mapping and an image synthesis using an XZ buffer.
Hitherto, there is a texture mapping as a typical method of expressing a quality feeling of 3-dimensional computer graphics. According to the texture mapping, a material feeling of an object can be formed by realizing an image which is obtained by a method whereby a texture pattern such as grain pattern, marble pattern, or the like which has independently been defined is adhered onto the surface of an object having a three-dimensional shape.
Two-dimensional coordinates which are obtained by projecting the surface shape of the 3-dimensional object on which the texture pattern was adhered are now defined as UV surface shape coordinates. Two-dimensional coordinates of a memory in which texture patterns have been stored are defined as ST texture coordinates. Further, two-dimensional coordinates of a frame memory to draw the surface shape on which a texture pattern has been mapped are defined as XY display coordinates. The values of those coordinates are expressed by small letters such as (u, v), (s, t), and (x, y), respectively.
In the texture mapping, it is a problem how to give the correspondence between the XY display coordinates of the frame memory for display and the ST texture coordinates of the texture pattern memory. In the case where the surface shape of a 3-dimensional object on which a texture pattern is adhered is not so geometrically complicated, coordinate values (x, t) of a proper texture pattern are given to each vertex of a polygon having a micro triangular or rectangular shape and the coordinate values which fill the region in the polygon are obtained by a linear interpolation.
The mapping to time frame memory from the memory in which the actual texture patterns have been stored is realized by a method whereby the texture pixel data read out from the texture pattern memory is written as pixel data (color values) which is written to the pixel positions in the frame memory.
In this instance, the reading operation of the texture pixel data from the texture pattern memory is executed by obtaining the coordinate values (s, t) of the ST texture coordinates corresponding to the coordinate values (u, v) of the UV surface shape coordinates of a 3-dimensional object by a linear interpolation. When the texture pixel data read out from the texture pattern memory is drawn into the frame memory, an address is designated by the values (x, y) of the XY display coordinates corresponding to the values (u, v) of the UV surface shape coordinates and the texture pixel data is written in such an address. In this case, as compared with a simple painting, the texture pixel data is read out every pixel from the texture pattern memory and written into the frame memory, so that a problem such that a drawing speed is extremely slow occurs.
To draw a texture pattern at a high speed, it is necessary to execute parallel processes so as to read out and draw a plurality of pixels in a lump. In case of using one texture pattern memory, it takes a time to read out a plurality of pixels. Therefore, the same pattern is stored into a plurality of texture pattern memories and a plurality of pixels are simultaneously read out by a digital signal processor or the like provided for every memory and are drawn. With this method, a high processing speed can be accomplished.
FIG. 1 is a schematic diagram showing a conventional texture mapping mechanism. Texture pattern memories 64-1 and 64-2 are individually provided for drawing processing units 32-1 and 32-2 provided in a 3-dimensional drawing mechanism 22. The same texture pattern is stored into the memories 64-1 and 64-2. The drawing processing units 32-1 and 32-2 read out two texture pixel data (color values) in parallel from the texture pattern memories 64-1 and 64-2 by using ST texture coordinates (s.sub.1, t.sub.1) and (s.sub.2, t.sub.2) obtained by the coordinates transformation and set the read-out texture pixel data into registers 68-1 and 68-2. Two texture pixel data in the registers 68-1 and 68-2 are simultaneously written into a frame memory 34 by the address designation by the XY display coordinate values (x, y). The mapping data of the texture pattern drawn in the frame memory 34 is read out by the address designation by the XY display coordinate values (x, y) and is displayed on a color display 28.
The texture coordinate values (s, t) in the texture pattern memory can be read out by an amount of only one pixel by a single access because addresses are discontinuously formed in dependence on a adhering method of the texture pattern. The frame memory, however, can draw a plurality of pixels at a time since drawing addresses (x, y) are continuous.
In the example of FIG. 1, two sets of digital signal processors and texture pattern memories are provided and image signals are processed in parallel every two pixels at a time. However, actually, about 8 to 64 sets of digital signal processors and texture pattern memories are provided and the parallel processes are executed.
In such a conventional texture mapping mechanism, however, a memory capacity increases in correspondence to the parallel processes. When a memory capacity is limited, therefore, a storage amount of patterns is also limited. Consequently, as the number of kinds of texture patterns increases, it is necessary to process the texture patterns while exchanging them.
In many cases, however, the texture patterns are stored in an external magnetic disk apparatus or the like. A very long time is needed to exchange the patterns as compared with the time which is necessary for the drawing process. There is a problem such that when an amount of texture patterns once reaches an amount such that it is necessary to exchange the patterns, the drawing speed suddenly fairly becomes slow.
In such a conventional texture mapping mechanism, on the other hand, no problem occurs in the case where the texture pixel data read out from the texture pattern memory is used and mapped to the XY display coordinates in the frame memory by a size of about (1:1). In case of enlarging a figure and drawing in the frame memory, however, there is a problem such that the texture pattern is drawn like a block and is unnaturally seen.
The above problems will now specifically be described with reference to FIGS. 2A to 2C. First, as shown in FIG. 2A, as for the texture pattern, for example, (8.times.8) pixels are set to one unit and the pixel data stored at each coordinate position, namely, the color value is conveniently expressed by ".circleincircle. x .increment. .box-solid.". FIG. 2B shows the case of drawing at a rate of (1:1). FIG. 2C shows the case of enlarging and drawing at a rate of (1:4).
In case of drawing at a rate of (1:1) as shown in FIG. 2B, four kinds of colors are mixed and an image is seen as if it were painted in a certain color when it is seen from a far position. The actual pixel on a display corresponds to a micropoint. The mapped texture pattern shown in the diagram is actually seen as a square of about 5 mm. However, as shown in FIG. 2C, in case of enlarging and drawing at a rate of about (1:4), since one texture pixel is magnified to (4.times.4)=16 pixels, even when it is seen from a far position, it is seen as a block-like rough pattern.
To solve the above problem, hitherto, in case of extremely magnifying, a texture pattern which has previously been magnified is separately prepared and used, thereby preventing that a block-like pattern appears. On the other hand, texture pixel data of the pixels which are arranged upon enlargement is obtained by a linear interpolation of the neighboring texture image data (color values) before enlargement. The color of the pixels arranged for enlargement is smoothly changed, thereby preventing that a block-like shape is seen. To prepare the enlarged texture patterns, however, a texture pattern memory of a large capacity is needed. There are also problems such that it takes a long calculating time to interpolate the color information of the pixel data of the number according to the magnification upon enlargement and that the drawing speed remarkably becomes slow.
On the other hand, the texture pattern memory 34 must be accessed by a drawing control mechanism 18 every interpolating calculation. There are, consequently, problems such that it takes a time to execute the linear interpolating calculation using the UV surface shape coordinates and ST texture coordinates and the mapping processing speed of the texture pattern is remarkably slower than that in case of a simple plain painting.
In the conventional drawing arithmetic operating mechanism, a performance such that a solid object is divided into a number of polygons and is expressed as a set of polygons and the polygons are drawn at a high speed is required.
The polygon is provided as 3-dimensional figure data including 3-dimensional coordinates (x, y, z) indicative of the position of each vertex of, for example, a triangle and color values of the vertexes. The 3-dimensional drawing mechanism develops such polygon vertex information to a set of pixels which are drawn into the frame memory. However, with respect to the polygon which were developed to the pixels, the color values of only the vertex pixels have been decided. Therefore, with respect to the color values of the pixels other than the pixels of the vertexes, the color values calculated by the linear interpolation are used and the pixels are drawn, so that the solid object can be more smoothly expressed.
In the actual calculations to obtain the color value of each pixel by the linear interpolation, a difference between the color value of the start pixel of the scan line which passes through the polygon and the color value of the end pixel is divided by the number of pixels existing between the start point and the end point and a change value per one pixel is obtained. After that, it is sufficient to add the change value to the preceding color value by an adder each time the pixel position is increased from the designated position.
However, since the change value which is used for interpolating calculation has a value below a decimal point, there are problems such that when the pixel position is increased to the final pixel position whose color value has previously been known, the adder causes an overflow or underflow, the color value changes to quite the different color value, and a color which is largely deviated from the inherent color is outputted.
Further, the conventional 3-dimensional graphics drawing apparatus has a hidden image erasing function using a Z buffer when a plurality of images are synthesized. That is, a depth coordinate value (z) of the image having the 3-dimensional coordinates (x, y, z) drawn in a plurality of frame buffers is used. Among the pixel data of a plurality of images existing at the same position, the pixel data of the image existing on this side is set to the effective data and the synthesized image is drawn.
The 3-dimensional frame buffer is constructed by a 2-dimensional frame buffer into which RGB pixel data is written by the address designated by the XY display coordinate values (x, y) and a Z buffer into which the depth coordinate value (z) corresponding to each pixel is likewise written by the address designation by the XY display coordinate values (x, y). A plurality of 3-dimensional frame buffers are provided to synthesize images.
An image synthesizing method in the 3-dimensional graphics apparatus is often used in a simulation or the like in which a plurality of objects move in front of a background image. An image in which a complicated background has previously been completed is prepared as a pattern and is transferred in accordance with a situation and is drawn and used. In this case, a 2-dimensional image such that all of the depth coordinate values (z) are set to the same value is prepared with respect to the background image. In the conventional apparatus, however, even when all of the depth coordinate values (z) are the same on the whole picture plane, they are written into the Z buffer every all of the pixels and the Z buffer of a large capacity is not effectively used.
Further, an expensive graphics workstation is used for a 3-dimensional display of a CAD of the machine system or a CAD of the architecture system. However, in association with the realization of a low price of a workstation, a using method whereby the result of the design can be confirmed as a 3-dimensional image even if a processing speed is slow is requested. A 3-dimensional graphics drawing apparatus of a low price which meets the low-price workstation is demanded.
In the conventional 3-dimensional graphics drawing apparatus installed in the workstation, however, since it has the Z buffer memory to store the depth coordinate value (z), as compared with a 2-dimensional drawing apparatus, the memory capacity increases and the costs rise since the Z buffer memory is additionally used.
To solve such a problem, it is considered that the Z buffer memory is provided in a main storage unit of the CPU. When the Z buffer memory is provided in the main storage unit of the CPU, however, the Z buffer memory is accessed via the bus of the CPU, so that an accessing speed becomes slow and the drawing performance is deteriorated.